package com.jdpc.weparty.reposity

import com.jdpc.weparty.entity.Activity
import com.jdpc.weparty.entity.User
import com.sun.istack.NotNull
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Modifying
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param
import org.springframework.stereotype.Repository
import org.springframework.transaction.annotation.Transactional


@Repository
interface UserRepository : JpaRepository<User, Int> {
    fun findByWxOpenId(wxOpenId: String): User?
    fun findByPhoneNumber(phoneNumber: String): User?

    /**
     * 根据活动查找该活动的发布者
     */
    fun findByPublishedActivities(activity: Activity): User

    /**
     * 根据活动查找该活动的审核者
     */
    fun findByExaminedActivities(activity: Activity): User
}